//
//  GHRecomendTableViewCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/21.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHMerchanFormTableViewCell.h"
#import "GHFormView.h"
@interface GHMerchanFormTableViewCell()
@property(nonatomic, strong) GHFormView                     *moneyView;
@property(nonatomic, strong) GHFormView                     *orderView;
@property(nonatomic, strong) GHFormView                     *timeView;
@property(nonatomic, strong) GHFormView                     *payTypeView;//支付方式
@property(nonatomic, strong) GHFormView                     *shenmaView;
@property(nonatomic, strong) GHFormView                     *seviceView;//平台服务费
@property(nonatomic, strong) GHFormView                     *typeView;//支付类型
@property(nonatomic, strong) GHFormView                     *statusView;
@end
@implementation GHMerchanFormTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 270;
}
#pragma mark --subView
- (void)configSubView{
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.moneyView = [[GHFormView alloc] initWithFrame:CGRectMake(0, 10, UIScreenWidth, 25)
                                             leftTitle:@"水"
                                        leftTitleColor:GH_firstTextColor
                                            rightTitle:@"2000"
                                       rightTitleColor:GH_YellowBackGroundColor];
    [self addSubview:self.moneyView];
    
    self.orderView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.moneyView.bottom, UIScreenWidth, 25)
                                             leftTitle:@"订单号"
                                        leftTitleColor:GH_secendTextColor
                                            rightTitle:@"-----"
                                       rightTitleColor:GH_secendTextColor];
    [self addSubview:self.orderView];
    
    
    
    self.timeView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.orderView.bottom , UIScreenWidth, 25)
                                            leftTitle:@"下单时间"
                                       leftTitleColor:GH_secendTextColor
                                           rightTitle:@"-----"
                                      rightTitleColor:GH_secendTextColor];
    [self addSubview:self.timeView];
    
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(10, self.timeView.bottom , UIScreenWidth - 20, 0.5)];
    line.backgroundColor = GH_lineColor;
    [self addSubview:line];
    
    self.payTypeView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.timeView.bottom + 0.5, UIScreenWidth, 25)
                                              leftTitle:@"现金支付"
                                         leftTitleColor:GH_secendTextColor
                                             rightTitle:@"140"
                                        rightTitleColor:GH_secendTextColor];
    [self addSubview:self.payTypeView];
    
    self.shenmaView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.payTypeView.bottom + 0.5, UIScreenWidth, 25)
                                              leftTitle:@"神马值支付"
                                         leftTitleColor:GH_secendTextColor
                                             rightTitle:@"140"
                                        rightTitleColor:GH_secendTextColor];
    [self addSubview:self.shenmaView];
    
    self.seviceView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.shenmaView.bottom, UIScreenWidth, 25)
                                            leftTitle:@"平台服务费"
                                       leftTitleColor:GH_secendTextColor
                                           rightTitle:@"28.0"
                                      rightTitleColor:GH_YellowBackGroundColor];
    [self addSubview:self.seviceView];
    
    self.typeView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.seviceView.bottom, UIScreenWidth, 25)
                                            leftTitle:@"支付类型"
                                       leftTitleColor:GH_secendTextColor
                                           rightTitle:@"现金支付"
                                      rightTitleColor:GH_YellowBackGroundColor];
    [self addSubview:self.typeView];
    
    
    self.statusView = [[GHFormView alloc] initWithFrame:CGRectMake(0, self.typeView.bottom, UIScreenWidth, 25)
                                              leftTitle:@"状态"
                                         leftTitleColor:GH_secendTextColor
                                             rightTitle:@"待确认"
                                        rightTitleColor:GH_YellowBackGroundColor];
    [self addSubview:self.statusView];
    
    
    self.moreButton = [[STButton alloc] initWithFrame:CGRectMake(0, self.statusView.bottom + 15, 60, 30)
                                                  title:@"更多"
                                             titleColor:[UIColor whiteColor]
                                              titleFont:13
                                           cornerRadius:6
                                        backgroundColor:GH_YellowBackGroundColor
                                        backgroundImage:nil
                                                  image:nil];
    self.moreButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.moreButton.right = UIScreenWidth - 10;
    [self addSubview:self.moreButton];
    

}
- (void)setModel:(GHMerchanModel *)model{
    _model = model;
    
    self.moneyView.textLabel.text = model.goods_name;
    self.moneyView.detailLabel.text = model.shopping_money;
    
    self.orderView.detailLabel.text = model.oid;
    
    NSDate * date = [NSDate dateWithTimeIntervalSince1970:[model.stime integerValue]].st_localDate;
    self.timeView.detailLabel.text = date.st_yyyyMMddhhmmssWithDate;
    
    self.payTypeView.detailLabel.text = model.cash_money;
    
    self.shenmaView.detailLabel.text = model.smz_money;
    
    self.seviceView.detailLabel.text = model.service_money;

    self.typeView.detailLabel.text = model.paySrting;
    
    self.statusView.detailLabel.text = model.statusString;
    

}

@end



